cmake_minimum_required(VERSION 3.10.0)

project(virtboardTest VERSION 0.1.0)

# 添加源文件
file(GLOB_RECURSE SOURCES 
    "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
)

# 添加头文件搜索路径
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/src
    ${CMAKE_CURRENT_SOURCE_DIR}/src/com
    ${CMAKE_CURRENT_SOURCE_DIR}/src/pages
    ${CMAKE_SOURCE_DIR}/lvgl
    ${CMAKE_SOURCE_DIR}/lv_drivers
)

# 创建可执行文件
add_executable(${PROJECT_NAME} ${SOURCES})

# 链接LVGL库
target_link_libraries(${PROJECT_NAME} PRIVATE
    lvgl
    lv_drivers
)

# 链接 tslib 库
target_link_libraries(${PROJECT_NAME} PRIVATE tslib)

# 设置RPATH相关属性
set_target_properties(${PROJECT_NAME} PROPERTIES
    INSTALL_RPATH "$ORIGIN/../lib"
    BUILD_WITH_INSTALL_RPATH TRUE
    SKIP_BUILD_RPATH FALSE
)

# 设置编译输出目录
set_target_properties(${PROJECT_NAME} PROPERTIES
    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)

# 安装目标
install(TARGETS ${PROJECT_NAME}
    RUNTIME DESTINATION bin
)